home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 44
/
Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso
/
Aminet
/
misc
/
emu
/
p-interp.lha
/
p-interp-0.4
/
float-conv.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-05-20
|
1KB
|
51 lines
/*
P-Code interpreter (to run the apple pascal system)
Copyright (C) 2000 Mario Klebsch
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Log: float-conv.c,v $
Revision 1.2 2001/05/20 13:12:02 mario
CVS-Idents und Logs eingefügt
*/
#ident "$Id: float-conv.c,v 1.2 2001/05/20 13:12:02 mario Exp $";
#include <stdio.h>
int main(int argc, char *argv[])
{
char Buffer[256];
while (fgets(Buffer, sizeof(Buffer), stdin))
{
float fl;
unsigned char *p=(unsigned char*)&fl;
unsigned short *us=(unsigned short*)&fl;
int i;
sscanf(Buffer, "%f", &fl);
for (i=0;i<sizeof(fl);i++)
printf("%02x ", p[i]);
printf("\n");
for (i=0;i<sizeof(fl)/sizeof(us[0]);i++)
printf("%04x ", us[i]);
printf("\n");
}
}